package com.gp.library.utils;

import java.math.BigDecimal;

/**
 * Created by jackdeng on 2021/4/13.
 */

public class MathUtils {
    /**
     * 保留b位小数
     */
    public static float getDecimalByByte(int b, float t){
        BigDecimal bd = new BigDecimal(t);
        bd = bd.setScale(b, BigDecimal.ROUND_HALF_UP);
        return bd.floatValue();
    }
}
